package com.li.jiang.controller;


import com.li.jiang.obj.vo.ResumeVO;
import com.li.jiang.service.impl.ResumeServiceImpl;
import com.li.jiang.utils.ReturnMessage;
import com.li.jiang.utils.role.RequireRoles;
import com.li.jiang.utils.role.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户基本简历表 前端控制器
 * </p>
 *
 * @author 李江
 * @since 2024-04-12
 */
@RestController
@RequestMapping("/resume")
public class ResumeController {

    @Autowired
    private ResumeServiceImpl resumeService;

    @RequireRoles(role = {Role.STUDENT})
    @GetMapping("/get/{uid}")
    public ReturnMessage getResumeByUid(@PathVariable("uid") Long uid){
        if (uid==null){
            return ReturnMessage.error("uid为空!");
        }
        ResumeVO resumeVO = resumeService.getResumeByUid(uid);

        if (resumeVO==null){
            return ReturnMessage.error("查询信息错误!");
        }
        return ReturnMessage.success("获取简历信息成功",resumeVO);
    }
    @RequireRoles(role = {Role.COMPANY})
    @GetMapping("/get/{rid}/{cid}")
    public ReturnMessage getResume(@PathVariable("rid") Long rid,@PathVariable("cid") Long cid){
        return ReturnMessage.success("获取简历成功");
    }
}
